export default {
  name: "primary",
  components: {
    feedback: () => import("./feedback/feedback.vue"),
    question: () => import("./question/question.vue")
  },
  data() {
    return {
      reFresh: true,
      isActive:  "1",
      search: "",
	  totalNum: 0,
      tabs: [],
      fkpower: {
        gryhyj: false,
        qyyhyj: false,
        cjwt: false,
        hzyxfk: true
      }
    }
  },
  created() {
    let permisstions = this.GLOBAL.permisstions
    permisstions.forEach(item => {
      if (item.power == 8) {
        this.tabs = item.tablelist
        this.tabs.forEach(items => {
          if (items.table == "8001") {
            this.fkpower.gryhyj = true
          } else if (items.table == "8002") {
            this.fkpower.qyyhyj = true
          } else if (items.table == "8003") {
            this.fkpower.cjwt = true
          }
        })
      }
    })
    if (!this.fkpower.gryhyj && this.fkpower.qyyhyj) {
      this.isActive = "3"
    } else if (
      !this.fkpower.gryhyj &&
      !this.fkpower.qyyhyj &&
      this.fkpower.cjwt
    ) {
      this.isActive = "2"
    }else if (
      !this.fkpower.gryhyj &&
      !this.fkpower.qyyhyj &&
      !this.fkpower.cjwt &&
      this.fkpower.hzyxfk
    ) {
      this.isActive = "4"
    };
	this.$set(this.tabs[0],'totalNum',0);
	this.$set(this.tabs[1],'totalNum',0);
	this.$set(this.tabs[2],'totalNum',0);
  },
  mounted() {
    this.get_height()
  },
  methods: {
    // 设置primary_content的高度
    get_height() {
      let body_h = document.body.clientHeight
      this.$refs.primary_content.style.height = body_h - 70 - 60 + "px"
    },
    selectTab(num) {
      //   this.$set("isActive", num)
      this.isActive = num
      // if (this.isActive == 2) {
      //   this.$router.push({
      //     path: "/home/feedback",
      //     query: {
      //       items: 2
      //     }
      //   })
      // } else {
      //   this.$router.push({
      //     path: "/home/feedback",
      //     query: {
      //       items: this.isActive
      //     }
      //   })
      // }
    }
  },
  watch: {
    isActive(newVal, oldVal) {
      this.reFresh = false
      this.$nextTick(() => {
        this.reFresh = true
      })
    }
  }
}
